from H3DInterface import *
import CUBE

# make sure the proxy is drawn at the position of the haptics device
di = getActiveDeviceInfo()
if(di):
  devices = di.device.getValue()
  for d in devices:
    d.proxyWeighting.setValue(0)

# Script
if getActiveDeviceInfo():
  for h in getActiveDeviceInfo().device.getValue():
    h.proxyWeighting.setValue(0)
 
d, = references.getValue()
# Temporarily small cube for testing gravity
size = Vec3f(0.07, 0.07, 0.07)
 
d.geometry.setValue( CUBE.createConstantITSCube(size, 16, 16))
h = CUBE.createConstantITSCube(size, 16, 16)
d.hapticGeometry.setValue(h)

# Update
d.restingCoord.route(h.coord)
